% Automatictypeinferencefro-MA.tex
\begin{hcarentry}[new]{Automatic type inference from JSON}
\label{jsonautotype}
\report{Michal J. Gajda}%05/15
\status{stable}
\makeheader

This rapid software development tool \href{https://github.com/mgajda/json-autotype}{\texttt{json-autotype}} interprets JSON
data and converts them into Haskell module with data type declarations.

\begin{verbatim}
$ json-autotype input.json -o JSONTypes.hs
\end{verbatim}

The generated declarations use automatically derived Aeson class instances
to read and write data directly from/to JSON strings,
and facilitate interaction with growing number of large JSON APIs.

Generated parser can be immediately tested on an input data:

\begin{verbatim}
$ runghc JSONTypes.hs input.json
\end{verbatim}

The software can be installed directly from Hackage.

It uses sophisticated union type unification, and robustly
interprets most ambiguities using clever typing.

The tool has reached maturity this year, and thanks to automated testing procedures it seems to robustly infer types
for all JSON inputs considered valid by Aeson.

The author welcomes comments and suggestions at \email{mjgajda@@gmail.com}.

\FurtherReading
\url{http://hackage.haskell.org/packages/json-autotype}
\end{hcarentry}
